package com.coder.bike.entity;

import com.baomidou.mybatisplus.annotation.*;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Getter;
import lombok.Setter;
import lombok.experimental.Accessors;

import java.io.Serializable;
import java.math.BigDecimal;
import java.time.LocalDateTime;

@Getter
@Setter
@Accessors(chain = true)
@TableName("busi_order")
public class Order implements Serializable {
    private static final long serialVersionUID = 1L;

    @TableId(value = "id", type = IdType.AUTO)
    private Integer id;

    private String orderNum;          // 订单编号
    private String bikeId;
    private String bikeNum;           // 单车编号
    private Integer customerId;        // 客户ID

    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private LocalDateTime startTime;  // 租用时间

    private Integer typeId;           // 租用类型ID
    private BigDecimal hourlyFee;     // 时租费用
    private BigDecimal deposit;       // 押金

    private Integer startMileage;     // 起始里程(米)
    private Integer startBattery;     // 起始电量(电动车型)

    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private LocalDateTime endTime;  // 归还时间

    private Integer endMileage;    // 归还里程(米)
    private Integer endBattery;    // 归还电量(电动车型)
    private Boolean status;
    private BigDecimal payableAmount;  // 应付金额
    private BigDecimal actualAmount;   // 实付金额
    private Boolean depositStatus;     // 押金是否返还

    @TableField(fill = FieldFill.INSERT)
    private LocalDateTime createTime;

    @TableField(fill = FieldFill.INSERT_UPDATE)
    private LocalDateTime updateTime;

    private Boolean deleted;

    // 查询字段
    @TableField(exist = false)
    private String customerName;
    @TableField(exist = false)
    private String customerTel;
    @TableField(exist = false)
    private String typeName;
}